package com.goods.controller;

import com.dto.GoodsDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
public class GoodsController {

    @GetMapping("/buyOne")
    public String buyOne(){
        return "成功的购买了一个商品";
    }

    @GetMapping("/goods/page")
    public List<GoodsDto> page(@RequestParam("goodsName") String goodsName){
        return Arrays.asList(
                new GoodsDto(1L,goodsName),
                new GoodsDto(2L,"小米汽车"),
                new GoodsDto(3L,"小米电饭锅")
        );
    }
}
